import { post, get, _delete, put } from '@/lin/plugin/axios'

class Room {
  static async addRoom(data) {
    const res = await post('v1/ag/room/create', data)
    return res
  }

  static async getRoom(id) {
    const res = await get(`v1/ag/room/${id}`)
    return res
  }
  static async getDetailByBuilding(id) {
    const res = await get(`/v1/ag/room/building_to_room/${id}`)
    return res
  }


  static async getDetail(id) {
    const res = await get(`/v1/ag/room/${id}/detail`)
    return res
  }

  static async editRoom(id, data) {
    const res = await put(`/v1/ag/room/${id}`, data)
    return res
  }

  static async deleteRoom(id) {
    const res = await _delete(`/v1/ag/room/${id}`)
    return res
  }

  static async getRooms(page = 0, count = 10) {
    const res = await get('/v1/ag/room/page', { page, count })
    return res
  }

  static async getRoomList() {
    const res = await get('/v1/ag/room/list')
    return res
  }
  static async search({ keyword, page, count }) {
    const res = await get('v1/ag/room/search', {
      keyword,
      page,
      count,
    })
    return res
  }
}

export default Room

